global dir "/Users/gsms data"


cd "$dir"

clear all

set maxvar 20000


use parents_figures, clear


preserve
*** Simple Diff in Diff by Race by After by Year ***
************ Figure 1 (Pooled) *************************
reg votedtotal  int1 int2  int4-int12   i.year  ai_par_tt  ag1_new ag2_new avghhincome_new if year >1990,  cl(gsms)
parmest, label list(parm label estimate min* max* p) level(95) saving(results, replace)
use results, clear
keep if _n<12
set obs 12
replace parm ="int3" in 12
destring parm, gen(parm2) ignore("int")
drop parm
rename parm2 parm
sort parm
replace estimate =0 if parm ==3
label variable estimate "Regression Coefficient"
label variable min95 "Lower 95% CI"
label variable max95 "Upper 95% CI"

#d;
twoway (line estimate parm, mcolor(black) msymbol(square) msize(small)) (rcap min95 max95 parm, lcolor(black)), 
yline(0, lp(dash) lcolor(red))
       graphregion(color(white)) 
       plotregion(color(white))
       aspect(.35)
       ysize(3.5)
	   yscale(range(-0.15(0.5)0.15))
	   ylabel(-0.15(0.05)0.15, nogrid)
       xlabel(1 "1992" 2 "1994" 3 "1996" 4 "1998" 5 "2000" 6 "2002" 7 "2004" 8 "2006" 9 "2008" 10 "2010" 11 "2012" 12 "2014", labsize(small)  glwidth(vthin) glpattern(shortdash) glcolor(gs13) nogmin)
       xtitle("{fontface Times New Roman:Years}")
       ytitle("{fontface Times New Roman:Voted in Election}") 
	   ;
graph save pretrend_parents_voting.gph, replace;
#d cr
restore



preserve
*** Simple Diff in Diff by Race by After by Year ***
************ Figure 1 (above median) *************************
reg votedtotal  int1 int2  int4-int12   i.year  ai_par_tt  ag1_new ag2_new if year >1990 & avghhincome_new>5.33 & avghhincome<.,  cl(gsms)
parmest, label list(parm label estimate min* max* p) level(95) saving(results, replace)
use results, clear
keep if _n<12
set obs 12
replace parm ="int3" in 12
destring parm, gen(parm2) ignore("int")
drop parm
rename parm2 parm
sort parm
replace estimate =0 if parm ==3
label variable estimate "Regression Coefficient"
label variable min95 "Lower 95% CI"
label variable max95 "Upper 95% CI"

#d;
twoway (line estimate parm, mcolor(black) msymbol(square) msize(small)) (rcap min95 max95 parm, lcolor(black)), 
yline(0, lp(dash) lcolor(red))
       graphregion(color(white)) 
       plotregion(color(white))
       aspect(.35)
       ysize(3.5)
       xlabel(1 "1992" 2 "1994" 3 "1996" 4 "1998" 5 "2000" 6 "2002" 7 "2004" 8 "2006" 9 "2008" 10 "2010" 11 "2012" 12 "2014", labsize(small) grid glwidth(vthin) glpattern(shortdash) glcolor(gs13) nogmin)
       xtitle("{fontface Helvetica:Years}")
       ytitle("{fontface Helvetica:Estimated Coefficient}") 
       title("{fontface Helvetica:Difference by Race for Voting for Parents Above Median Inc}", size(medium) pos(11)) clegend(on ring(0));
graph save pretrend_parents_voting.gph, replace;
#d cr
restore



preserve
*** Simple Diff in Diff by Race by After by Year ***
************ Figure 1 (below median) *************************
reg votedtotal  int1 int2  int4-int12   i.year  ai_par_tt  ag1_new ag2_new if year >1990 & avghhincome_new<=5.33,  cl(gsms)
parmest, label list(parm label estimate min* max* p) level(95) saving(results, replace)
use results, clear
keep if _n<12
set obs 12
replace parm ="int3" in 12
destring parm, gen(parm2) ignore("int")
drop parm
rename parm2 parm
sort parm
replace estimate =0 if parm ==3
label variable estimate "Regression Coefficient"
label variable min95 "Lower 95% CI"
label variable max95 "Upper 95% CI"

#d;
twoway (line estimate parm, mcolor(black) msymbol(square) msize(small)) (rcap min95 max95 parm, lcolor(black)), 
yline(0, lp(dash) lcolor(red))
       graphregion(color(white)) 
       plotregion(color(white))
       aspect(.35)
       ysize(3.5)
       xlabel(1 "1992" 2 "1994" 3 "1996" 4 "1998" 5 "2000" 6 "2002" 7 "2004" 8 "2006" 9 "2008" 10 "2010" 11 "2012" 12 "2014", labsize(small) grid glwidth(vthin) glpattern(shortdash) glcolor(gs13) nogmin)
       xtitle("{fontface Helvetica:Years}")
       ytitle("{fontface Helvetica:Estimated Coefficient}") 
       title("{fontface Helvetica:Difference by Race for Voting for Parents Below Median Inc}", size(medium) pos(11)) clegend(on ring(0));
graph save pretrend_parents_voting.gph, replace;
#d cr
restore



